package com.zbkj.crmeb.system.monitor;

import com.utils.monitor.DingMsgEnum;
import com.utils.monitor.DingTalkMsgUtil;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;

@Component
public class SystemPublishMonitor implements ApplicationRunner {
    /**
     * 系统发布监控
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        String hostName = "";
        try {
            // 获取本地主机对象
            InetAddress localHost = InetAddress.getLocalHost();
            hostName = localHost.getHostAddress();
        } catch (UnknownHostException e) {

        }
        DingTalkMsgUtil.sendMsg(DingMsgEnum.SYSTEM,hostName+":主机已部署成功,时间:"+new Date()+" cc.@王松林(萝卜)");
    }
}
